<?php
session_start();
include '../conn.php';
$uid = $_REQUEST['uid'];

$sql = "SELECT * FROM user WHERE id = '" . $uid . "'";
$result = $conn->query($sql);

if ($result->num_rows <= 0) {
    echo '请先注册或登录！';
    exit;
}
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>服装商城</title>
  <link rel="stylesheet" type="text/css" href="../css/general.css">
  <link rel="stylesheet" type="text/css" href="../css/index.css">
  <link rel="stylesheet" type="text/css" href="../css/list.css">
  <script type="text/javascript" src="../js/jquery.js"></script>
  <script type="text/javascript" src="../js/general.js"></script>
  <script type="text/javascript" src="../js/carousel.js"></script>
  <style>
    .container {
        width: 1100px;
        margin: 0 auto;
    }
    .top-buttons {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 20px 0;
    }
    .top-buttons a {
        color: #1369C0;
        text-decoration: none;
        transition: background-color 0.3s, color 0.3s;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
    .top-buttons a:hover {
        background-color: #1369C0;
        color: #fff;
    }
    .user-info-table {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        border: 1px solid #ddd;
        border-radius: 8px;
        background-color: #fff;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    .user-info-table th,
    .user-info-table td {
        padding: 10px;
        border-bottom: 1px solid #ddd;
    }
    .user-info-table th {
        text-align: right;
        background-color: #f1f1f1;
    }
    .user-info-table tr:last-child th,
    .user-info-table tr:last-child td {
        border-bottom: none;
    }
  </style>
</head>
<body>
<!-- 顶部开始 -->

<!-- 头部开始 -->
<div class="header-body">
    <!-- 头部开始 -->
    <?php include 'header.php'; ?>
    <!-- 头部结束 -->
</div>
<!-- 头部结束 -->
<!-- 主体开始 -->
<div class="container">
    <!-- 顶部按钮 -->
    <div class="top-buttons">
        <a href="edituserinfo.php?uid=<?php echo $uid ?>">修改信息</a>
        <a href="upload.php?uid=<?php echo $uid ?>">上传头像</a>
        <a href="order.php?uid=<?php echo $uid ?>">我的订单</a>
        <a href="showHistory.php?uid=<?php echo $uid ?>">我的历史</a>
        <a href="showLove.php?uid=<?php echo $uid ?>">我的喜爱</a>
        <a href="showCollect.php?uid=<?php echo $uid ?>">我的收藏</a>
        <a href="showCommentList.php?uid=<?php echo $uid ?>">我的评论</a>
    </div>

    <!-- 用户信息表格 -->
    <?php
    while ($row = $result->fetch_assoc()) {
        $sexx = $row['sex'] == 1 ? '男' : '女';
        echo "<table class='user-info-table'>";
        echo "<tr><td colspan='2' style='text-align:center; font-size: 20px; font-weight: bold; padding: 10px; background-color: #f9f9f9; border-bottom: 1px solid #ddd;'>个人信息表</td></tr>";
        echo "<tr><th>用户名</th><td>{$row['uname']}</td></tr>";
        echo "<tr><th>性别</th><td>{$sexx}</td></tr>";
        echo "<tr><th>头像</th><td><img src='" . $row['avatar'] . "' width='80px'></td></tr>";
        echo "<tr><th>密码</th><td>{$row['pwd']}</td></tr>";
        echo "<tr><th>手机号</th><td>{$row['tel']}</td></tr>";
        echo "<tr><th>邮箱</th><td>{$row['email']}</td></tr>";
        echo "</table>";
    }
    ?>
</div>
<!-- 主体结束 -->

<!-- 页脚开始 -->
<div style="margin-top:50px;"></div>
<?php include '../footer.php'; ?>
<!-- 页脚结束 -->

</body>
</html>